exports = {
  data : {
    id  : 0,
    info: {},
    jsfTpl : {}
  },
  use : ['rb','jquery','form','element'],
  init : function(rb,$) {
    // 删除顶层 icon-select
    // if(layui.cache.debug && $("body>#icon-select").length ){ $("body>#icon-select").remove(); }
    var that  = this;
    if(that.data.id){
      var url = layui.cache.apiPath + rb.controller + '/detail';
      rb.getJSONSync(url,{id : that.data.id},function(data) {
        that.data.info = data;
      });
    }
    // TODO 查询上级菜单
    $.ajaxSettings.async = false;
    // rb.d.menus = rb.getSortList([
    var $menus = [
      {
        id:1,
        name:"[TODO] SYS",
        parent:0,
        //   children:[
        //     {id:2,name:"系统管理",parent:1,},
        //     {id:34,name:"角色权限",parent:2,},
        //     {id:105,name:"系统维护",parent:3,},
        //   ]
      },
    ];
    // ]);
    $.ajaxSettings.async = true;
    var $parent = that.data.info['parent'] ?? 0;
    $menus.unshift({'id':0,'name':'* '+L('top-level')+' *','child':[]});
    var info = this.data.info;
    this.data.jsfTpl = rb.jsfTpls(this.data.info,[
      ['*name'],
      ['*parent|selects|'+$parent,'',$menus],
      ['url'],
      ['icon|icon'],
      ['params'],
      ['show|radio','','',3],
      ['desc|textarea','input-long'],
      ['sort|number'],
    ],{
      'name'  : L('title'),
      'parent': L('parent'),
      'url'   : L('url'),
      'params': L('url para'),
      'show'  : L('show')
    });
  },
  after : function(rb,$,form,ele,layer){
    // TODO 渲染完后
    console.log("this.data",this.data);
    form.render(null,"jsf-menu-form");
    // jsf-menu-icon
    <!--# include virtual="/lib/icon-select.js" -->
  }
}